package com.example.haosiji.activity;


import com.example.haosiji.R;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

public class SelectDriver extends Activity{

	private TextView driver_name;
	private TextView driver_distance;
	private TextView driver_Years;
	private TextView driver_Times;
	private TextView call_driver;
	String phone;
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activityselectdialog);
		
		Intent intent = getIntent();
		
		Bundle bundle = intent.getBundleExtra("data");
		
		phone = bundle.getString("number");
		
		
		String name = bundle.getString("name");
		driver_name = (TextView)findViewById(R.id.driver_name);
		driver_name.setText(name);
		
		
		String distance = bundle.getString("distance");
		driver_distance = (TextView)findViewById(R.id.driver_distance);
		driver_distance.setText(distance);
		
		String drivingTimes = bundle.getString("drivingTimes");
		driver_Times = (TextView)findViewById(R.id.drivingTimes);
		driver_Times.setText(drivingTimes);
		
		String drivingYears = bundle.getString("drivingYears");
		driver_Years = (TextView)findViewById(R.id.drivingYears);
		driver_Years.setText(drivingYears);
		
		
		call_driver = (TextView)findViewById(R.id.call_driver);
		call_driver.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				
				Intent myIntentDial = new Intent("android.intent.action.CALL",Uri.parse("tel:"+phone));
				startActivity(myIntentDial);
				
			}
		});
		
		
		Log.i("11111111111111111", phone);
	}
	
	public boolean onTouchEvent(MotionEvent event){
		finish();
		return true;
	}

	
	
}
